<?php

use yii\db\Migration;

/**
 * Class m181112_083935_init_people
 */
class m181112_083935_init_people extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = null;
        $this->createTable('people', [
            'id' => $this->primaryKey(),
            'name' => $this->string()->notNull()->unique(),
            'age' => $this->string(32)->notNull(),
            'email' => $this->string()->notNull()->unique(),
            'cellphone' => $this->string()->notNull(),
            'avatar' => $this->string()->notNull(),
            'gender' => $this->string()->notNull(),
            'address' => $this->string()->unique(),
            'status' => $this->smallInteger()->notNull()->defaultValue(10),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
        ], $tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('people');
        echo "m181112_083935_init_people cannot be reverted.\n";
    }
}
